﻿using System;
using System.Collections.Generic;
using RootfusHostView;
using System.Windows;

namespace RootfusCoreComponents
{
    /// <summary>
    /// When a pin is connected to an input pin, we must keep track
    /// of the pins that send us data. Unfortunately, not only the pin,
    /// but also the item that is sending us that information!
    /// </summary>
    public class IncomingPinConnectionInfo : DependencyObject
    {
        /// <summary>
        /// The pin on the item this guy refers to get its data.
        /// </summary>
        public string Pin
        {
            get { return (string)GetValue(PinProperty); }
            set { SetValue(PinProperty, value); }
        }

        // Using a DependencyProperty as the backing store for Pin.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty PinProperty =
            DependencyProperty.Register("Pin", typeof(string), typeof(IncomingPinConnectionInfo), new UIPropertyMetadata(null));

        /// <summary>
        /// The item that is supplying us with the pin's information.
        /// </summary>
        public RootfusSurfaceItemWrapper Item
        {
            get { return (RootfusSurfaceItemWrapper)GetValue(ItemProperty); }
            set { SetValue(ItemProperty, value); }
        }

        // Using a DependencyProperty as the backing store for Item.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty ItemProperty =
            DependencyProperty.Register("Item", typeof(RootfusSurfaceItemWrapper), typeof(PinConnection), new UIPropertyMetadata(null));

        /// <summary>
        /// Simple init-er.
        /// </summary>
        /// <param name="item"></param>
        /// <param name="pin"></param>
        public IncomingPinConnectionInfo(RootfusSurfaceItemWrapper item, string pinName)
        {
            Pin = pinName;
            Item = item;
        }

        /// <summary>
        /// Default ctor which puts the item and pin at null. For ease of use...
        /// </summary>
        public IncomingPinConnectionInfo()
        {
        }
    }
}
